"""
给一个只包含0和1的数组，找出最长的全是1的子数组,返回长度。

"""

def find_ones(l):
    maxnum = num = 0
    for i in l:
        num = num + 1 if i == 1 else 0
        maxnum = max(num, maxnum)
    
    return maxnum

l =  [1,1,0,1,1,1,1,0,0,0,0,0,1,1,1,0,0,1]
r = find_ones(l)
print(r)